package com.qujia.station.service;

import com.qujia.common.core.domain.AjaxResult;
import com.qujia.station.domain.*;
import com.qujia.station.domain.dto.DivideAccountsSettingDto;
import com.qujia.station.domain.dto.OilSaleNumDto;
import com.qujia.station.domain.dto.RegionalReportDto;
import com.qujia.station.domain.form.PayOrderDetailQueryForm;
import com.qujia.station.domain.form.PayOrderEmployeeQueryForm;
import com.qujia.station.domain.vo.*;
import com.qujia.system.domain.SysRespon;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 订单支付Service接口
 *
 * @author qujia
 * @date 2020-12-10
 */
public interface IPayOrderService
{
    /**
     * 查询订单支付
     *
     * @param orderId 订单支付ID
     * @return 订单支付
     */
    public PayOrder selectPayOrderById(Long orderId);

    /**
     * 批量删除订单
     * @return
     */
    public int deletePay(List<Long> list);
    /**
     * 修改一段时间内的订单的金额
     *
     *
     */
    void updatePayOrderAmt(Map<String, Object> params);
    void addOrderAmountModificationLog(OrderAmountModificationLog log);

    /**
     * 查询订单支付
     *
     * @param orderId 订单支付ID
     * @return 订单支付
     */
    public PayOrder selectPayOrderForFeiEById(Long orderId);

    /**
     * 查询订单支付列表
     *
     * @param payOrder 订单支付
     * @return 订单支付集合
     */
    public List<PayOrder> selectPayOrderListUserPaytime(PayOrder payOrder);


    /**
     * 查询分账到账列表
     *
     * @param DivideAccounts 订单支付
     * @return 订单支付集合
     */
    public List<DivideAccounts> queryDivideAccountsList(DivideAccounts divideAccounts);

    public List<DivideAccountsSettingDto> queryDivideSettingList(DivideAccountsSettingDto divideAccountsSettingDto);


    public DivideAccountsDetailVo selectDivideAccountsDetail(String uuid);

    public DivideAccountsSettingDto selectDivideSettingDetail(@Param("beginMmo") String beginMmo,@Param("stationId") String stationId);

    public int selectDivideSettingStatus(String beginMmo,String status);

    /**
     * 查询订单支付列表
     *
     * @param payOrder 订单支付
     * @return 订单支付集合
     */
    public List<PayOrder> selectPayOrderList(PayOrder payOrder);

    public AjaxResult creationDivideSetting(DivideAccountsSettingDto divideAccountsSettingDto) ;

    public AjaxResult updateDivideSetting(DivideAccountsSettingDto divideAccountsSettingDto) ;
    /**
     * 查询所有订单
     *
     * @param payOrder 订单支付
     * @return 订单支付集合
     */
    public List<PayOrder> selectAllPayOrderList(PayOrder payOrder);

    /**
     * 查询七天内汇总
     *
     * @param payOrder 订单支付
     * @return 订单支付集合
     */
    public  List<Map<String, Object>> homeSevenSumQuery(PayOrder payOrder,List<ClassSettlementCard> rechargeAmtSeven);

    public List<Map<String, Object>> homePaymentSumQuery(PayOrder payOrder);


    /**
     * 新增订单支付
     *
     * @param payOrder 订单支付
     * @return 结果
     */
    public int insertPayOrder(PayOrder payOrder);

    /**
     * 新增订单支付
     *
     * @param payOrder 订单支付
     * @return 结果
     */
    public AjaxResult insertPayOrderForStar(PayOrder payOrder);


    /**
     * 修改订单支付
     *
     * @param payOrder 订单支付
     * @return 结果
     */
    public int updatePayOrder(PayOrder payOrder);

    public int updatePayOrderByOrderNo(PayOrder payOrder);

    /**
     * 批量删除订单支付
     *
     * @param orderIds 需要删除的订单支付ID
     * @return 结果
     */
    public int deletePayOrderByIds(Long[] orderIds);

    /**
     * 删除订单支付信息
     *
     * @param orderId 订单支付ID
     * @return 结果
     */
    public int deletePayOrderById(Long orderId);



    /**
     * 查询当天的油品信息
     * @param payOrder
     * @return
     */
    public PayOrder selectDaySources(PayOrder payOrder);


    /**
     * 查询所有的订单信息
     * @param payOrder
     * @return
     */
    public PayOrder selectAllDaySources(PayOrder payOrder);

    /**
     * 按照油品分类获取数据
     * @param payOrder
     * @return
     */
    public List<PayOrder> selectOilTypeSources(PayOrder payOrder);

    /**
     * 按照油品分类获取全部数据
     * @param payOrder
     * @return
     */
    public List<PayOrder> selectAllOilTypeSources(PayOrder payOrder);

    /**
     * 收入数据概览，获取数据
     * @param payOrder
     * @return
     */
    public  PayOrder selectOverViewData(PayOrder payOrder);

    /**
     * 收入数据概览，获取数据（包括已经退款的信息）
     * @param payOrder
     * @return
     */
    public  PayOrder selectAllOverViewData(PayOrder payOrder);
    /**
     * 查询月报的订单信息
     * @param payOrder
     * @return
     */
    public List<PayOrder> selectDayReport(PayOrder payOrder);
    /**
     * 查询月报的订单信息（包括已经退款的）
     * @param payOrder
     * @return
     */
    public List<PayOrder> selectAllDayReport(PayOrder payOrder);

    /**
     * 用于历史数据日报
     * 月报数据(包括已经退款的)
     * @param payOrder
     * @return
     */
    public List<PayOrder> selectNewAllDayReport(PayOrder payOrder);

    /**
     * 查询订单统计量
     *
     * @param payOrder 订单支付
     * @return 订单支付集合
     */
    public List<StatisticsPayOrder> selectStatisticsPayOrderList(PayOrder payOrder);

    /**
     * 通过油品统计信息
     *
     * @param oilPayOrderSum 订单支付
     * @return 订单支付集合
     */
    public List<OilPayOrderSum> selectOilPayOrderSum(PayOrder oilPayOrderSum);


    /**
     * 通过油品统计信息
     *
     * @param payOrder 订单支付
     * @return 订单支付集合
     */
    public OilPayOrderSum selectOilPayOrderAllSum(PayOrder payOrder);

    /**
     * 查询订单合计信息
     *
     * @param payOrder 订单支付
     * @return 订单支付集合
     */
    public StatisticsPayOrder selectStatisticsPayOrderSum(PayOrder payOrder);


    /**
     * 日报折线图获取油品数据
     * @param payOrder
     * @return
     */
    public List<PayOrder> listQydata(PayOrder payOrder);

    /**
     * 获取x轴数据
     * @param payOrder
     * @return
     */
    public List<PayOrder> listXdata(PayOrder payOrder);

    /**
     * 查询导出信息
     * @param payOrder
     * @return
     */
    public List<PayOrder> selectPayOrderExport(PayOrder payOrder);

    /**
     * 小程序查询汇总订单
     *
     * @param payOrder 订单支付
     * @return 汇总信息
     */
    public PayOrder selectAppletPayOrderSum(PayOrder payOrder);

    /**
     * 查询LNG导出信息
     * @param payOrder
     * @return
     */
    public List<PayOrder> selectLNGPayOrderExport(PayOrder payOrder);


    /**
     * 汇总订单统计信息
     * @param payOrder
     * @return
     */
    public PayOrder selectSumPayOrder(PayOrder payOrder);
    /**
     * 查询总数
     *
     *
     * @return
     */
    public int getStatusCount(PayOrder payOrder);
    /**
     * 查询数据，根据员工汇总数据
     * @param payOrder
     * @return
     */
    public  List<PayOrder> selectPersonnelStructure(PayOrder payOrder);

    /**
     * 查询数据， 根据油品汇总
     * @param payOrder
     * @return
     */
    public List<PayOrder> selectOilStructure(PayOrder payOrder);

    /**
     * 初始化数据班结数据，根据员工/支付方式汇总
     * @param payOrder
     * @return
     */
    public List<PayOrder> selectPersonnelPayStructure(PayOrder payOrder);

    /**
     * 查询本站第一笔订单
     * @param payOrder
     * @return
     */
    public PayOrder getPayOrderInfoMin(PayOrder payOrder);

    /**
     * 日报数据详情
     * @param payOrder
     * @return
     */
    public List<PayOrder> dayOilTypeSources(PayOrder payOrder);

    /**
     * 日报数据详情（包括已经退款的）
     * @param payOrder
     * @return
     */
    public List<PayOrder> dayAllOilTypeSources(PayOrder payOrder);

    /**
     * LNG 站点人员查询数据
     * @param payOrder
     * @return
     */
    public List<PayOrder> LNGDeptList(PayOrder payOrder);

    /**
     * 关联用户查询订单支付列表
     */
    public List<PayOrder> selectUserPayOrderList(PayOrder payOrder);


    public String selectOrderStatus(PayOrder payOrder);

    public AjaxResult sxfRefund(PayOrder payOrder) throws  Exception;


    public int chengePayOrder() throws  Exception;

    /**
     * 查询订单支付
     *
     * @param merchantsNumber 订单支付ID
     * @return 订单支付
     */
    public PayOrder selectOrderInfoByMerchantsNumber(String merchantsNumber);

    List<PayOrderEmployeeQueryVo> payOrderEmployeeList(PayOrderEmployeeQueryForm payOrderEmployeeQueryForm);

    PayOrderEmployeeQueryVo payOrderEmployeeStatistics(PayOrderEmployeeQueryForm payOrderEmployeeQueryForm);

    List<PayOrderDetailQueryVo> payOrderDetailList(PayOrderDetailQueryForm payOrderDetailQueryForm);

    void updatePayOrderPrintStatus(String orderNo);


    List<PayOrder> selectCdkPayOrderList(PayOrder payOrder);

    List<PayOrder> selectNewCdkPayOrderList(PayOrder payOrder);

    List<PayOrder> selectCdkPayHisOrderList(PayOrder payOrder);

    List<StatisticsPayOrder> newSelectStatisticsPayOrderList(PayOrder payOrder);

    StatisticsPayOrder newSelectStatisticsPayOrderSum(PayOrder payOrder);

    /**
     * 随行付退款
     * @param amt 退款金额
     * @param orderNo 退款订单号
     * @param origOrderNo 原消费订单号
     * @param mno 商户号
     * @return
     * @throws Exception
     */
    SysRespon sendSxfRefundOrder(BigDecimal amt, String orderNo,String origOrderNo, String mno) throws Exception;

    SysRespon sendSxfRefundOrder(BigDecimal amt, String origOrderNo, String mno) throws Exception;

    /**
     * 云化退款
     * @param refundOrderNo 退款订单号
     * @param payOrder
     * @param payWay
     * @return
     * @throws Exception
     */
    SysRespon yunHuaRefundV2(String refundOrderNo,PayOrder payOrder,PayWay payWay) throws Exception;
    SysRespon yunHuaRefundV2(PayOrder payOrder, PayWay payWay) throws Exception;


    List<PayOrder> selectPayOrderAndHisPayOrderList(PayOrder payOrder);

    /**
     * 查询订单支付列表，包括提现金额
     *
     * @param payOrder 订单支付
     * @return 订单支付集合
     */
    public List<PayOrder> selectPayOrderAndWithdrawalAmountList(PayOrder payOrder);

    public BigDecimal reductionActivitiesAmountCalculation(ReduActiVO reduActiVO);

    int dzkRefund(PayOrder payOrder);

    List<StatisticsPayOrder> selectRegionalReport(RegionalReportDto regionalReportDto);

    /**油品销售数量*/
    List<OilSaleNumDto> getOilSaleNumList(PayOrder payOrder);

    List<YunHuaOrderInfo> selectPayOrderListByStartTime(String startTime);

    String getOrderStatus(YunHuaOrderInfo yunHuaOrderInfo);

    void refundPresent(String orderNo);
}
